//
//  CustomView.m
//  SYiDaiy
//
//  Created by dllo on 16/9/12.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "CustomView.h"
#import "TAMacro.h"

@implementation CustomView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        _offlineButton = [UIButton buttonWithType:UIButtonTypeCustom];
        _offlineButton.backgroundColor = [UIColor whiteColor];
        [_offlineButton setImage:[UIImage imageNamed:@"IconBooks"] forState:UIControlStateNormal];
        [_offlineButton setTitle:@"点击离线全部图片" forState:UIControlStateNormal];
        [_offlineButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
        [self addSubview:_offlineButton];
        _removeButton = [UIButton buttonWithType:UIButtonTypeCustom];
        _removeButton.backgroundColor = [UIColor whiteColor];
        
        [_removeButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
        [_removeButton setImage:[UIImage imageNamed:@"IconOfflineTrash"] forState:UIControlStateNormal];
        [self addSubview:_removeButton];
        _collectionButton = [UIButton buttonWithType:UIButtonTypeCustom];
        _collectionButton.backgroundColor = [UIColor whiteColor];
        [_collectionButton setTitle:@"收藏夹" forState:UIControlStateNormal];
        [_collectionButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
        [_collectionButton setImage:[UIImage imageNamed:@"IconMoreFav"] forState:UIControlStateNormal];
        [self addSubview:_collectionButton];
        _setButton = [UIButton buttonWithType:UIButtonTypeCustom];
        _setButton.backgroundColor = [UIColor whiteColor];
        [_setButton setTitle:@"设置" forState:UIControlStateNormal];
        [_setButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
        [_setButton setImage:[UIImage imageNamed:@"IconMoreSettings"] forState:UIControlStateNormal];
        [self addSubview:_setButton];
        _feedBackButton = [UIButton buttonWithType:UIButtonTypeCustom];
        _feedBackButton.backgroundColor = [UIColor whiteColor];
        [_feedBackButton setImage:[UIImage imageNamed:@"ButtonEntryToolOuter"] forState:UIControlStateNormal];
        [_feedBackButton setTitle:@"反馈" forState:UIControlStateNormal];
        [_feedBackButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
        [self addSubview:_feedBackButton];
    }
    return self;
}

- (void)layoutSubviews
{
    CGFloat width = SCREEN_WIDTH / 2;
    
    _offlineButton.frame = CGRectMake(0, 0, width, 50);
    _removeButton.frame = CGRectMake(width + 1, 0, width, 50);
    CGFloat width1 = (SCREEN_WIDTH - 30) / 3;
    CGFloat y = 60;
    CGFloat height = 30;
    _collectionButton.frame = CGRectMake(5, y, width1, height);
    _setButton.frame = CGRectMake(width1 + 15, y, width1, height);
    _feedBackButton.frame = CGRectMake(width1 * 2 + 25, y, width1, height);
}

@end
